package com.matrix.demo;

import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    CustomView mCustomView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mCustomView = findViewById(R.id.cv_view);
        //        ViewPortHandler.zoomIn(30f,60f);

        clickView();
    }

    private void clickView() {
        mCustomView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int width = mCustomView.getWidth();
                int height = mCustomView.getHeight();
                Log.i("down", "width = " + width + ", height = " + height);
            }
        });
    }

    private void matrix1() {
        Matrix matrix = new Matrix();
        matrix.preScale(0.5f, 0.8f);
        matrix.preTranslate(1000, 1000);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        super.onTouchEvent(event);
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                Log.i("down", "Action Down");
            case MotionEvent.ACTION_MOVE:
                ViewPortHandler.zoomIn(30f,60f);
                break;
        }
        return false;
    }
}
